home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 November / Chip Kasım 2000.iso / prog / share / 11 / setup.exe / %MAINDIR% / DEMOS / CIHTTP / HTTPEXP / exsppt.bas < prev    next >
Encoding:
BASIC Source File  |  2000-09-07  |  9.0 KB  |  242 lines

  1. Attribute VB_Name = "ExplorerSupport"
  2. Option Explicit
  3.  
  4. '<Constant>-----------------------------------------------------
  5. '---- misc
  6. Public Const nodPlaceHolder         As String = "..."
  7.  
  8. '---- http anchor types
  9. Public Const refUnkown              As Integer = -1
  10. Public Const refFTPServer           As Integer = 0
  11. Public Const refHTTPServer          As Integer = 1
  12. Public Const refFullPath            As Integer = 2
  13. Public Const refUpPath              As Integer = 3
  14. Public Const refDownPath            As Integer = 4
  15. Public Const refWebPage             As Integer = 5
  16.  
  17. '---- Attachment constants
  18. '---- NodeTypes
  19. Public Const nodUndefined           As Integer = -1
  20. Public Const nodDesktop             As Integer = 1
  21. Public Const nodMyComputer          As Integer = 2
  22. Public Const nodHTTPServers         As Integer = 3
  23. Public Const nodLocalDrive          As Integer = 4
  24. Public Const nodLocalFolder         As Integer = 5
  25. Public Const nodHTTPServer          As Integer = 6
  26. Public Const nodHTTPFolder          As Integer = 7
  27.  
  28. '---- Small and Large Icons
  29. Public Const imgDesktop             As Integer = 1
  30. Public Const imgPC                  As Integer = 2
  31. Public Const imgNetwork             As Integer = 3
  32. Public Const imgFolderClosed        As Integer = 4
  33. Public Const imgFolderOpen          As Integer = 5
  34. Public Const imgDriveNotShared      As Integer = 6
  35. Public Const imgDriveShared         As Integer = 7
  36. Public Const imgCDRom               As Integer = 8
  37. Public Const imgNetDrive            As Integer = 9
  38. Public Const imgHTTPDrive           As Integer = 10
  39. Public Const imgLocalFile           As Integer = 11
  40. Public Const imgHTTPFile            As Integer = 12
  41. Public Const imgFloppyDrive         As Integer = 13
  42. Public Const imgHTTPServers         As Integer = 14
  43. Public Const imgHTTPLink            As Integer = 15
  44. Public Const imgHTTPLinkOpen        As Integer = 16
  45. Public Const imgPlaceHolder         As Integer = 17
  46.  
  47. '---- Toolbar
  48. Public Const imgUpOneLevel          As Integer = 1
  49. Public Const imgConNetDrive         As Integer = 2
  50. Public Const imgDisconNetDrive      As Integer = 3
  51. Public Const imgConHTTPServer       As Integer = 4
  52. Public Const imgDisconHTTPServer    As Integer = 5
  53. Public Const imgLargeIcons          As Integer = 6
  54. Public Const imgSmallIcons          As Integer = 7
  55. Public Const imgList                As Integer = 8
  56. Public Const imgDetails             As Integer = 9
  57. '</Constant>----------------------------------------------------
  58.  
  59. '---------------------------------------------------------------
  60. '<Purpose> checks to see is a key exists in a nodes collection
  61. '---------------------------------------------------------------
  62. Public Function IsKeyed(TheseNodes As Nodes, NodeKey As String) As Boolean
  63.     Dim InstanceNode As Node
  64.     
  65.     For Each InstanceNode In TheseNodes
  66.         If (InstanceNode.Key = NodeKey) Then
  67.             IsKeyed = True
  68.             GoTo Cleanup
  69.         End If
  70.     Next
  71.     
  72.     IsKeyed = False
  73.     
  74. Cleanup:
  75.     Set InstanceNode = Nothing
  76. End Function
  77.  
  78. '---------------------------------------------------------------
  79. '<Purpose> sets a ListViews ColumnHeader state for persistence
  80. '---------------------------------------------------------------
  81. Public Sub SetColumnHeaderState(ThisWindow As Form, ThisAppName As String)
  82.     Dim InstanceHeader  As ColumnHeader
  83.     Dim Header          As Integer
  84.     Dim Info            As String
  85.     Dim Section         As String
  86.     
  87.     Header = 1
  88.     For Each InstanceHeader In ThisWindow.List.ColumnHeaders
  89.         Section = "ListView Header " & Header
  90.         Info = CStr(InstanceHeader.Width)
  91.         Call SaveSetting(App.ProductName, ThisAppName, Section, Info)
  92.         Header = Header + 1
  93.     Next
  94.     
  95. End Sub
  96.  
  97. '---------------------------------------------------------------
  98. '<Purpose> sets the splitter bar position for persistence
  99. '---------------------------------------------------------------
  100. Public Sub SetSplitterBarState(ThisWindow As Form, ThisAppName As String)
  101.     Dim Info As String
  102.  
  103.     Info = CStr(ThisWindow.picSeparator.left)
  104.     Call SaveSetting(App.ProductName, ThisAppName, "SplitterBarState", Info)
  105.  
  106. End Sub
  107.  
  108. '---------------------------------------------------------------
  109. '<Purpose> gets the splitter bar position for persistence
  110. '---------------------------------------------------------------
  111. Public Sub GetSplitterBarState(ThisWindow As Form, ThisAppName As String)
  112.     Dim Info     As String
  113.  
  114.     If (App.ProductName = "") Then
  115.         MsgBox "You must enter a 'Product Name' using the EXE Options dialog box before you continue.", vbOKOnly + vbInformation
  116.         Exit Sub
  117.     End If
  118.     
  119.     'get the splitter info ------------------
  120.     Info = GetSetting(App.ProductName, ThisAppName, "SplitterBarState")
  121.     
  122.     'move the splitter to its new position ---------------
  123.     If (Info <> "") Then
  124.         Call ThisWindow.SplitMe(CInt(Info), ThisWindow.Tree)
  125.     End If
  126.     
  127. End Sub
  128.  
  129. '-----------------------------------------------------------------
  130. '<Purpose> puts all of the children of a node in the details list
  131. '-----------------------------------------------------------------
  132. Public Sub ListChildren(ThisExplorer As Form, ParentNode As Node)
  133.     Dim i               As Integer
  134.     Dim NumberChildren  As Integer
  135.     Dim WorkingItem     As ListItem
  136.     Dim TheseItems      As ListItems
  137.     Dim WorkingNode     As Node
  138.     
  139.     '---- cache ListItems collection
  140.     Set TheseItems = ThisExplorer.List.ListItems
  141.     
  142.     NumberChildren = ParentNode.Children
  143.     For i = 1 To NumberChildren
  144.         If (i = 1) Then
  145.             Set WorkingNode = ParentNode.Child
  146.         Else
  147.             Set WorkingNode = WorkingNode.Next
  148.         End If
  149.         
  150.         Set WorkingItem = TheseItems.Add(, WorkingNode.Key, WorkingNode.Text, WorkingNode.Image, WorkingNode.Image)
  151.     
  152.         '---  add type, size, and modified bits
  153.         WorkingItem.SubItems(2) = Type2String(GetNodeType(ThisExplorer, WorkingNode))
  154.     Next
  155.     
  156.     Set TheseItems = Nothing
  157.     Set WorkingItem = Nothing
  158.     Set WorkingNode = Nothing
  159. End Sub
  160.  
  161. '---------------------------------------------------------------
  162. '<Purpose> gets a ListViews ColumnHeader state for persistence
  163. '---------------------------------------------------------------
  164. Public Sub GetColumnHeaderState(ThisWindow As Form, ThisAppName As String)
  165.     Dim InstanceHeader  As ColumnHeader
  166.     Dim Header          As Integer
  167.     Dim Info            As String
  168.     Dim Section         As String
  169.     
  170.     If (App.ProductName = "") Then
  171.         MsgBox "You must enter a 'Product Name' using the EXE Options dialog box before you continue.", vbOKOnly + vbInformation
  172.         Exit Sub
  173.     End If
  174.     
  175.     Header = 1
  176.     For Each InstanceHeader In ThisWindow.List.ColumnHeaders
  177.         Section = "ListView Header " & Header
  178.         Info = GetSetting(App.ProductName, ThisAppName, Section)
  179.         If (Info <> "") Then
  180.             ThisWindow.List.ColumnHeaders(Header).Width = CInt(Info)
  181.         End If
  182.         Header = Header + 1
  183.     Next
  184. End Sub
  185.  
  186. '-------------------------------------------------------------------
  187. '<Purpose> gets the attachment for a given node
  188. '-------------------------------------------------------------------
  189. Public Function GetAttachment(ThisExplorer As Form, ThisNode As Node) As Attachment
  190.     
  191.     On Error GoTo NoAttachment
  192.     Set GetAttachment = ThisExplorer.Attachments.Item(ThisNode.Key)
  193.     On Error GoTo 0
  194.     Exit Function
  195.     
  196. NoAttachment:
  197.     Set GetAttachment = Nothing
  198.     On Error GoTo 0
  199.     
  200. End Function
  201.  
  202. '-------------------------------------------------------------------
  203. '<Purpose> gets the node type of a given node
  204. '-------------------------------------------------------------------
  205. Public Function GetNodeType(ThisExplorer As Form, ThisNode As Node) As Integer
  206.     Dim ThisAttachment  As Attachment
  207.     
  208.     On Error GoTo NoAttachment
  209.     Set ThisAttachment = ThisExplorer.Attachments.Item(ThisNode.Key)
  210.     GetNodeType = ThisAttachment.NodeType
  211.     
  212. Cleanup:
  213.     Set ThisAttachment = Nothing
  214.     On Error GoTo 0
  215.     Exit Function
  216.     
  217. NoAttachment:
  218.     GetNodeType = nodUndefined
  219.     GoTo Cleanup
  220.     
  221. End Function
  222.  
  223. '-------------------------------------------------------------------
  224. '<Purpose> converts a node type to a string
  225. '-------------------------------------------------------------------
  226. Public Function Type2String(NodeType As Integer) As String
  227.  
  228.     Select Case NodeType
  229.         Case nodUndefined:          Type2String = "Unidentified"
  230.         Case nodDesktop:            Type2String = "Desktop"
  231.         Case nodMyComputer:         Type2String = "My Computer"
  232.         Case nodHTTPServers:        Type2String = "HTTP Servers"
  233.         Case nodLocalDrive:         Type2String = "Local Drive"
  234.         Case nodLocalFolder:        Type2String = "Local Folder"
  235.         Case nodHTTPServer:         Type2String = "HTTP Server"
  236.         Case nodHTTPFolder:         Type2String = "HTTP Folder"
  237.         Case Else:                  Type2String = "Unknown"
  238.     End Select
  239.  
  240. End Function
  241.  
  242.